from . import admin_blueprint
from app.auth.session_check import SessionCheck
from flask import redirect, render_template


@admin_blueprint.route('/index')
def index():
    if SessionCheck.is_admin() is False:
        return redirect('/')
    site = {
        'is_logged': True,
        'title': '课程管理系统 - 管理页面',
        'current_page': 'index',
    }
    return render_template('admin_index.html', site=site)


@admin_blueprint.route('/course')
def course():
    if SessionCheck.is_admin() is False:
        return redirect('/')
    site = {
        'is_logged': True,
        'title': '课程管理系统 - 课程管理',
        'current_page': 'course',
    }
    return render_template('admin_course.html', site=site)